/*************************************************
filename	: delge_manager.h
author		: Stefan lulham
desc		: A basic event descriptor.
*************************************************/
#ifndef D_DELGE_EVENT_H
#define D_DELGE_EVENT_H

#include <string>
#include <modules\input\input_enums.h>

using namespace std;
using namespace DelGE::Modules::Input;

namespace DelGE
{
	namespace Managers
	{
		namespace Event
		{
			enum EventType
			{
				DelGE_Event_SystemWindow_Close,					// Uses WindowData
				DelGE_Event_SystemWindow_GainedFocus,			// Uses WindowData
				DelGE_Event_SystemWindow_LostFocus,				// Uses WindowData
				DelGE_Event_SystemWindow_CharacterInput,		// Uses CharacterInputData
				DelGE_Event_SystemWindow_KeyPressed,			// Uses KeybordData
				DelGE_Event_SystemWindow_KeyReleased,			// Uses KeybordData
				DelGE_Event_SystemWindow_MousePressed,			// Uses MouseData
				DelGE_Event_SystemWindow_MouseReleased,			// Uses MouseData
				DelGE_Event_SystemWindow_MouseMoved,			// Uses MouseData
				DelGE_Event_SystemWindow_MouseWheelMoved,		// Uses MouseData
				DelGE_Event_SystemWindow_MouseEnter,			// Uses MouseData
				DelGE_Event_SystemWindow_MouseLeave,			// Uses MouseData

				DelGE_Event_Game_Quit,
				DelGE_Event_Game_ChangeScreen,
				DelGE_Event_Game_SwitchToFullscreen,
				DelGE_Event_Game_SwitchToWindowed,
				DelGE_Event_Game_ToggleFullscreen,

				DelGE_Event_Count
			};

			struct SystemWindowEvent
			{
				void* pWindow;									// This will contain a pointer to the
																// interface version of the gadget/window
																// so it will need to be cast to that
																// e.g. Win32SystemWindow*
			};

			struct SystemWindowEvent_CharacterInput : SystemWindowEvent
			{
				char cCharacterInput;							// The character input
			};

			struct SystemWindowEvent_Keybord : SystemWindowEvent
			{
				KeyCode eKeyCode;								// Which key?
			};

			struct SystemWindowEvent_Mouse : SystemWindowEvent
			{
				int iMouseX, iMouseY;							// Mouse position
				int iMouseWheelDelta;							// Mouse wheel delta (1 - scroll up, 2 - scroll down)
				MouseCode eMouseButton;							// Which mouse button?
			};

			struct GameEvent
			{
				void* pData;
			};

			struct GameEvent_ChangeScreen : public GameEvent
			{
				int iScreenIndex;
			};

			class DelGEEvent
			{
			public:
				// The class data
				EventType eType;								// What type of event?

				// The event data
				union
				{
					SystemWindowEvent					WindowData;
					SystemWindowEvent_CharacterInput	CharacterInputData;
					SystemWindowEvent_Keybord			KeybordData;
					SystemWindowEvent_Mouse				MouseData;
					GameEvent							GameData;
					GameEvent_ChangeScreen				ScreenData;
				};
			};
		}
	}
}

#endif